# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer:
pkgname=pup
pkgver=0.4.0
pkgrel=1
pkgdesc="HTML parser for the command line"
url="https://github.com/ericchiang/pup"
arch="all"
license="MIT"
makedepends="go"
subpackages="$pkgname-doc"
source="https://github.com/ericchiang/pup/archive/v$pkgver/pup-$pkgver.tar.gz"
builddir="$srcdir/src/github.com/ericchiang/pup"

export GOPATH="$srcdir"

prepare() {
	default_prepare
	cd "$srcdir"
	mkdir -p "$(dirname "$builddir")"
	ln -s "$srcdir/$pkgname-$pkgver" "$builddir"
}

build() {
	go build
}

check() {
	go test ./...
}

package() {
	install -Dm755 $pkgname \
		"$pkgdir"/usr/bin/$pkgname
	install -Dm644 README.md \
		"$pkgdir"/usr/share/doc/$pkgname/README.md
}

cleanup_srcdir() {
	go clean -modcache
	default_cleanup_srcdir
}

sha512sums="5228a283cdbc6425888b08154873e059f5808efd68eb86880d15572398e50b0a431922e6ef5e6acf04bc18c95bfd793590d5df2eccb9a041a64dc03731ec1874  pup-0.4.0.tar.gz"
